	
	$('.li1Child').hide();
	$('#music').hide();

	/*seiper*/
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true,
     	direction: 'vertical',
        loop:true,
       	onSlideChangeEnd: function(swiper){
      	$('.li1Child').find('li').eq(1).addClass('lil');
      	$('.li1Child').find('li').eq(3).addClass('lil');
      	$('.li1Child').find('li').eq(2).addClass('lir');
      	$('.li1Child').find('li').eq(0).addClass('lir');
    }
    });
	/*music*/
	function showMusic(){
		
		var $music = $('#music');
		var $audio1 = $('#audio1');		
		var onoff = true;
		$music.on('touchstart',function(){
			if(onoff){
				$(this).attr('class','active');
				$audio1.get(0).play();
			}
			else{
				$(this).attr('class','');
				$audio1.get(0).pause();
			}
			onoff = !onoff;
		});
		$music.trigger('touchstart');
		
	}
	
	/*画布*/
	    var attr=['ad4.png','b.png','c.png','d.png','e.png','ad1.png','ad2.png','ad3.png','ad4.png','b.png'];
	  
	    var Alld=document.querySelectorAll('.swiper-slide>div');
	    
	    var iNow=0;
		for(var i=0;i<attr.length;i++){
			var objImg = new Image();			
			objImg.src = 'img/'+attr[i];
			
			Alld[i].style.background='url(img/'+attr[i]+') no-repeat 50% 0%';
			
			Alld[i].style.backgroundSize='120% 100%';
			objImg.onload = function(){
				iNow++;
												
				if(iNow == attr.length){
					$('#loading').animate({opacity:0},1000,function(){
					$('#loading').remove();
					});
				}
			};
		}
	
//

	var clientWidth = document.documentElement.clientWidth;
	var clientHidth = document.documentElement.clientHeight;
	var canvas=document.getElementById('cv');
	   	canvas.setAttribute('width',clientWidth+'px');
		canvas.setAttribute('height',clientHidth+'px');
		makecanvas();
			
	function makecanvas(){
		
		var context=canvas.getContext('2d');			
		var img=new Image();
        img.src='img/a.png';
        img.onload=function(){
        	
     	context.drawImage(img,0,0,clientWidth,clientHidth);      
             
        context.globalCompositeOperation='destination-out';
		context.lineWidth=50;
		context.lineCap='round';
		context.lineJoin='round';
		//
		$('#cv').on('touchstart',function(ev){
			var e=ev.originalEvent.changedTouches[0];
   			var x= e.clientX - canvas.offsetLeft;
    		var y= e.clientY - canvas.offsetTop;
		context.moveTo(x,y);
		
		$('#cv').on('touchmove.aaa',function(ev){
			
			var e=ev.originalEvent.changedTouches[0];
   			var x= e.clientX - canvas.offsetLeft;
    		var y= e.clientY - canvas.offsetTop;
    		ev.originalEvent.preventDefault();
			context.lineTo(x,y);
			context.stroke();
		
		});
		 $('#cv').on("touchend.aaa",function(ev){
       		 $('#cv').off('.aaa');
			 justy();
		})
		});
		function justy(){
		var data=context.getImageData(0,0,clientWidth,clientHidth).data;
		
		var len=data.length;
		
		var cnt=0;
		
		for(var i=3;i<len;i+=4){
		
			if(data[i]==0){
				cnt++;
				
			}
		}
		
		if(cnt/(len/4)>0.1){
			$('#cv').animate({opacity:0},1000,'linear',function(){
			
			$('#cv').hide();
			$('.li1Child').show();			
			$('#music').show();
			showMusic();
			
			})
			
		  }
	   }
	}
	

        }
				
